package com.example.basicknowledge;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.example.basicknowledge.GridView.GridViewActivity;
import com.example.basicknowledge.MediaPlayer.MediaPlayerActivity;
import com.example.basicknowledge.RecyclerActivity.RecyclerActivity;
import com.example.basicknowledge.SQL数据库.SQLActivity;
import com.example.basicknowledge.ScrollViewActivity.ScrollViewActivity;
import com.example.basicknowledge.SpinnerActivity.SpinnerActivity;
import com.example.basicknowledge.UI基本外形和控制.BaseUIAndControl;
import com.example.basicknowledge.ViewPager_Fragment.ViewPagerActivity;
import com.example.basicknowledge.WebView.WebViewActivity;
import com.example.basicknowledge.偏好设置.PreferenceFragmentActivity;
import com.example.basicknowledge.图片切换器.ImageSwitcherActivity;
import com.example.basicknowledge.带返回值的跳转.ReceiveResultJump;
import com.example.basicknowledge.弹出对话框.UsageOfAlertDialog;
import com.example.basicknowledge.各种按钮.Buttons;
import com.example.basicknowledge.文本切换器.TextSwitcherActivity;
import com.example.basicknowledge.用loader实现网络请求.LoaderNetworkActivity;
import com.example.basicknowledge.网络请求.NetworkActivity;
import com.example.basicknowledge.菜单的使用.UsageOfMenu;
import com.example.basicknowledge.设置圆角.RoundedCorner;
import com.example.basicknowledge.运动事件的处理.CatchMotionEvent;
import com.example.basicknowledge.进度条.ProgressActivity;
import com.example.basicknowledge.键盘事件的响应.KeyboardAction;

public class BasicKnowledge extends AppCompatActivity implements AdapterView.OnItemClickListener {

    private String[] data = { "UI基本外形和控制","键盘事件的响应","运动事件的处理","带返回值的跳转","菜单的使用","弹出对话框","Buttons","WebView","表示进度的","Spinner","文本切换器","图片切换器","ScrollView","RecyclerView","本地化中xliff:g>标签的使用","GridView","Media Player","ViewPager/Fragment","网络请求","用loader的网络请求","偏好设置","SQL数据库","设置圆角"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_basic_knowledge);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                BasicKnowledge.this, android.R.layout.simple_list_item_1, data);
        ListView listView = (ListView) findViewById(R.id.catalogueList);
        listView.setAdapter(adapter);

        listView.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        switch (adapterView.getId()) {
            case R.id.catalogueList:
                System.out.println(i);
                break;
        }
        if (adapterView.getId() == R.id.catalogueList) {
            switch (i) {
                case 0:
                    System.out.println("跳转到UI基本外形和控制的Activity");
                    Intent intent = new Intent(this, BaseUIAndControl.class);
                    startActivity(intent);
                    break;
                case 1:
                    System.out.println("跳转到键盘事件的响应的Activity");
                    Intent intent1 = new Intent(this, KeyboardAction.class);
                    startActivity(intent1);
                    break;
                case 2:
                    System.out.println("跳转到运动事件的Activity");
                    Intent intent2 = new Intent(this, CatchMotionEvent.class);
                    startActivity(intent2);
                    break;
                case 3:
                    System.out.println("跳转到带返回值的跳转的Activity");
                    Intent intent3 = new Intent(this, ReceiveResultJump.class);
                    startActivity(intent3);
                    break;
                case 4:
                    System.out.println("跳转到菜单的使用的Activity");
                    Intent intent4 = new Intent(this, UsageOfMenu.class);
                    startActivity(intent4);
                    break;
                case 5:
                    System.out.println("跳转到弹出对话框的Activity");
                    Intent intent5 = new Intent(this, UsageOfAlertDialog.class);
                    startActivity(intent5);
                    break;
                case 6:
                    System.out.println("跳转到Buttons的Activity");
                    Intent intent6 = new Intent(this, Buttons.class);
                    startActivity(intent6);
                    break;
                case 7:
                    System.out.println("跳转到WebView的Activity");
                    Intent intent7 = new Intent(this, WebViewActivity.class);
                    startActivity(intent7);
                    break;
                case 8:
                    System.out.println("跳转到表示进度的Activity");
                    Intent intent8 = new Intent(this, ProgressActivity.class);
                    startActivity(intent8);
                    break;
                case 9:
                    System.out.println("跳转到Spinner的Activity");
                    Intent intent9 = new Intent(this, SpinnerActivity.class);
                    startActivity(intent9);
                    break;
                case 10:
                    System.out.println("跳转到Spinner的Activity");
                    Intent intent10 = new Intent(this, TextSwitcherActivity.class);
                    startActivity(intent10);
                    break;
                case 11:
                    System.out.println("跳转到Spinner的Activity");
                    Intent intent11 = new Intent(this, ImageSwitcherActivity.class);
                    startActivity(intent11);
                    break;
                case 12:
                    System.out.println("跳转到Spinner的Activity");
                    Intent intent12 = new Intent(this, ScrollViewActivity.class);
                    startActivity(intent12);
                    break;
                case 13:
                    System.out.println("跳转到RecyclerView的Activity");
                    Intent intent13 = new Intent(this, RecyclerActivity.class);
                    startActivity(intent13);
                    break;
                case 14:
                    String tmp = getString(R.string.knowledge_title,"本地化中xliff:g>标签的使用");
                    Toast.makeText(this,tmp,Toast.LENGTH_SHORT).show();
                    break;
                case 15:
                    System.out.println("跳转到GridView的Activity");
                    Intent intent15 = new Intent(this, GridViewActivity.class);
                    startActivity(intent15);
                    break;
                case 16:
                    System.out.println("跳转到Media Player的Activity");
                    Intent intent16 = new Intent(this, MediaPlayerActivity.class);
                    startActivity(intent16);
                    break;
                case 17:
                    System.out.println("跳转到ViewPagerActivity的Activity");
                    Intent intent17 = new Intent(this, ViewPagerActivity.class);
                    startActivity(intent17);
                    break;
                case 18:
                    System.out.println("跳转到网络请求的Activity");
                    Intent intent18 = new Intent(this, NetworkActivity.class);
                    startActivity(intent18);
                    break;
                case 19:
                    System.out.println("跳转到网络请求的Activity");
                    Intent intent19 = new Intent(this, LoaderNetworkActivity.class);
                    startActivity(intent19);
                    break;
                case 20:
                    System.out.println("跳转到偏好设置的Activity");
                    Intent intent20 = new Intent(this, PreferenceFragmentActivity.class);
                    startActivity(intent20);
                    break;
                case 21:
                    System.out.println("跳转到偏好设置的Activity");
                    Intent intent21 = new Intent(this, SQLActivity.class);
                    startActivity(intent21);
                    break;

                case 22:
                    System.out.println("跳转到设置圆角的Activity");
                    Intent intent22 = new Intent(this, RoundedCorner.class);
                    startActivity(intent22);
                    break;

            }
        }
    }
}
